package com.ibsol.utils
{
	public  class PlayerUtils
	{
		public static function formatVideoTime(t : Number) : String//格式化时间处理函数
		{
			var s : Number = Math.floor(t);//取整数
			var hour : Number = int(s/3600);//取小时
			var minute : Number = int((s-hour*3600)/60);//取分钟
			var second : Number = s-hour*3600-minute*60;//取秒
			var p : Number = Math.round( ( t - s ) * 1000 );//取毫秒
			//转特定格式“hh:mm:ss xxx”  padStr(hour.toString(), 2) + ":" + 
			return padStr(minute.toString(), 2) + ":" + padStr(second.toString(), 2);
		}
		
		public static function padStr(src : String, len : int ) : String//添加前导零
		{	
			if ( src.length > len )//若字符串长度超过指定长度，则截断字符串 
				return src.substr(0, len);			
			var s : String = src;
			for ( var i : int = s.length;  s.length < len; )//添加前导零 
			{
				s = "0" + s;
			}
			return s;
		} 
	}
}